From: Marek Marczykowski-Górecki Date: Thu, 5 Apr 2018 01:50:54 +0000 (+0200) Subject: tools/gdbsx: fix -Wstringop-truncation warning X-Git-Tag: archive/raspbian/4.11.1-1+rpi1~1^2~66^2~228 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=7f601f7c341c80d554615556d60e3b8ed1e5ad4f;p=xen.git tools/gdbsx: fix -Wstringop-truncation warning gcc-8 complains: gx_main.c: In function 'prepare_stop_reply': gx_main.c:385:9: error: 'strncpy' output truncated before terminating nul copying 6 bytes from a string of the same length [-Werror=stringop-truncation] strncpy(buf, "watch:", 6); ^~~~~~~~~~~~~~~~~~~~~~~~~ Since terminating '\0' isn't needed here at all, switch to memcpy. Signed-off-by: Marek Marczykowski-Górecki Acked-by: Wei Liu Release-Acked-by: Juergen Gross --- diff --git a/tools/debugger/gdbsx/gx/gx_main.c b/tools/debugger/gdbsx/gx/gx_main.c index a908c45e1d..6dfa501145 100644 --- a/tools/debugger/gdbsx/gx/gx_main.c +++ b/tools/debugger/gdbsx/gx/gx_main.c @@ -382,7 +382,7 @@ prepare_stop_reply(enum target_signal sig, char *buf, vcpuid_t vcpu) /* TBD: check if we stopped because of watchpoint */ if (watchpoint_stop()) { - strncpy(buf, "watch:", 6); + memcpy(buf, "watch:", 6); buf += 6; /* TBD: **/ }